<html>
	<head>
		<title>ajax</title>
		<script src="jquery-1.12.1.min.js"></script>
		<script type="text/javascript">
			$(function (){
				$("#submit").click(function () {
					var formData = $("#ajaxform").serialize();
					$.ajax({
						type:"POST",
						url:"do.php",
						data:formData,
						cache:false,
						success:function (data) {
							//console.log(data);
							$(".box").html(data);
						}
					})
					return false;
				});
			});
		</script>
	</head>
	<body>
		<form id="ajaxform" method="post">
			<label>name:</label>
			<input type="text" name="username" />
			<label>password:</label>
			<input type="text" name="password" />
			<input type="submit" id="submit" value="Go">
		</form>
		<div class="box"></div>
	</body>
</html>